//
//  ViewController.swift
//  swift-04
//
//  Created by xuPeng on 2017/8/7.
//  Copyright © 2017年 陈旭鹏. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
    var scrollView : UIScrollView!
    
    var leftView = LeftView()
    var centerView = CenterView()
    var rightView = RightView()
    
    override func viewDidLoad() {
        
        super.viewDidLoad()
        
        UIApplication.shared.isStatusBarHidden = true

        self.addChildViewController(leftView)
        self.scrollView.addSubview(leftView.view)
        leftView.didMove(toParentViewController: self)
        
        self.addChildViewController(rightView)
        self.scrollView.addSubview(rightView.view)
        rightView.didMove(toParentViewController: self)
        
        self.addChildViewController(centerView)
        self.scrollView.addSubview(centerView.view)
        centerView.didMove(toParentViewController: self)
        
        var centerViewFrame: CGRect = centerView.view.frame
        centerViewFrame.origin.x = self.view.frame.width
        centerView.view.frame = centerViewFrame
        
        var rightViewFrame: CGRect = rightView.view.frame
        rightViewFrame.origin.x = 2 * self.view.frame.width
        rightView.view.frame = rightViewFrame
       
        
        self.scrollView.contentSize = CGSize(width: self.view.frame.width * 3, height: self.view.frame.size.height)
        self.view .addSubview(self.scrollView)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

